import Vue from 'vue'
import VueRouter from 'vue-router'
import userUtiils from '../utils/userUtils'

Vue.use(VueRouter)

  const routes = [
  {
    path: '/index',
    name: 'index',
    component: () => import('../views/index.vue'),
	beforeEnter:(to,from,next) => {
		if(userUtiils.isLogin()){
			next()
		} else {
			next('/login')
		}
	},
	meta: {
		isShowTab : true
	}
  },
  {
    path: '/classify',
    name: 'classify',
    component: () => import('../views/classify.vue'),
	meta: {
		isShowTab : true
	}
  },
  {
    path: '/shop',
    name: 'shop',
    component: () => import('../views/shop.vue'),
	meta: {
		isShowTab : false
	}
  },
  {
    path: '/user',
    name: 'user',
    component: () => import('../views/user.vue'),
	meta: {
		isShowTab : true
	}
  },
  {
    path: '/Kanjiainner',
    name: 'Kanjiainner',
    component: () => import('../views/Kanjiainner.vue'),
  	meta: {
  		isShowTab : true
  	}
  },
  {
    path: '/Pelinner',
    name: 'Pelinner',
    component: () => import('../views/Pelinner.vue'),
  	meta: {
  		isShowTab : true
  	}
  },
  {
    path: '/Zhuaninner',
    name: 'Zhuaninner',
    component: () => import('../views/Zhuaninner.vue'),
  	meta: {
  		isShowTab : true
  	}
  },
  {
    path: '/Zhuaninfo',
    name: 'Zhuaninfo',
    component: () => import('../views/Zhuaninfo.vue'),
  	meta: {
  		isShowTab : true
  	}
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login.vue'),
  	meta: {
  		isShowTab : true
  	}
  },
  {
    path: '/zhuce',
    name: 'zhuce',
    component: () => import('../views/zhuce.vue'),
  	meta: {
  		isShowTab : true
  	}
  },
  {
    path: '/Giftcertificate',
    name: 'Giftcertificate',
    component: () => import('../views/Giftcertificate.vue'),
  	meta: {
  		isShowTab : true
  	}
  },
  {
    path: '/addRess',
    name: 'addRess',
    component: () => import('../views/addRess.vue'),
  	meta: {
  		isShowTab : true
  	}
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
